//
//  CClass.h
//  GoldOperationClient
//
//  Created by yaxue wang on 16/8/1.
//  Copyright © 2016年 展鸿科技. All rights reserved.
//
#import <Foundation/Foundation.h>

#import "BaseModel.h"
// 图片上传文件最大限制(400KB)
#define IMAGE_MAX_SIZE 400 * 1024

@interface CClass : NSObject

+ (NSString *) getRand;

+ (BOOL) checkPassword:(NSString *)password;

+ (NSString *) getUUID;

+ (NSString *)base64:(NSString *)str;
+ (NSString *)debase64:(NSString *)str;
+ (NSString *)escape:(NSString *)str;
+ (NSString*)encodeString:(NSString*)unencodedString;

+ (void) saveCacheData:(NSString *)data key:(NSString *)key;
+ (NSString *) getCacheData:(NSString*)key;

+ (void) saveCacheObject:(id)object key:(NSString *)key;
+ (id) getCacheObject:(NSString *)key;

+ (void) clearCacheData:(id) key;
+ (BOOL) hasCacheData:(NSString *)key;
//将图片保存到本地
+ (void)SaveImageToLocal:(UIImage*)image Keys:(NSString*)key;
//从本地获取图片
+ (UIImage*)GetImageFromLocal:(NSString*)key;
+ (NSDictionary *)remakeParam:(NSDictionary *)parameters;

+ (UIColor *)getColor:(NSString *)hexColor;

+ (NSString *) transformDateFromString:(NSString *)datestr andFormat:(NSString *)fromformat toFormat:(NSString *)toformat;
+ (NSString *)formatHtml:(NSString *)html;
+ (NSString *) formatStringSplit:(NSString *) str space:(NSInteger)space place:(NSString *)place;
+(NSString*)replace:(NSString*)phone;
+ (void)HttpRequestTask:(BOOL)isPost withUrl:(NSString *)url withData:(NSDictionary *)parameters notifyError:(BOOL)notifyError onSuccess:(void (^)(BaseModel * model))success onError:(void (^)(BaseModel * model))error;
+ (void)HttpRequestTask:(BOOL)isPost withUrl:(NSString *)url withData:(NSDictionary *)parameters notifyError:(BOOL)notifyError onSuccess:(void (^)(BaseModel * model))success onError:(void (^)(BaseModel * model))error progress:(void (^)(float)) progress;


+ (UIImage *)squareImageFromImage:(UIImage *)image scaledToSize:(CGFloat)newSize;
+ (UIImage *)resizeImage:(UIImage *)image ByWidth:(float) width;
/**
 * 压缩图片质量
 */
//把图片变成固定的长宽
+ (UIImage *)reSizeImage:(UIImage *)image toSize:(CGSize)reSize;
+ (NSData *)compressImageQuality:(UIImage *)image;
+ (UIImage *)resizeImage:(UIImage *)image FromSize:(CGSize) size;
+ (void)showMessage:(NSString *)message;
+ (void)showMessage:(NSString *)message completion:(void (^)())completion;
+ (void)showLittleTimeMessage:(NSString *)message  completion:(void (^)())completion;
+ (void)openImagePicker:(id)controller sourceType:(UIImagePickerControllerSourceType)sourceType allowsEditing:(BOOL)allowsEditing;
+ (void)setImagePickerStyle:(UIImagePickerController *)controller;
+ (void)deleteFileWithPath:(NSString *)path;
+ (void) showAlertTitle:(NSString *) title  hidden:(BOOL)state context:(NSString*)context oneBtn:(NSString*)oneBtnTitle twoBtn:(NSString*)twoBtnTitle handler:(void (^)(void))oneBtn handler:(void (^)(void))twoBtn;
+ (UINavigationController*)getLastNavigationController;
///虚线
+ (void)layoutDottedLineWithoriginY:(float)originY WithAddSubview:(UIView *)view;
+ (NSString *)disable_emoji:(NSString *)text;
+ (BOOL)stringContainsEmoji:(NSString *)string;
//iOS 判断是否开启定位
+ (BOOL)isLocationServiceOpen;
@end
